
import groovy.text.GStringTemplateEngine


def prettify = { sex ->
    return "abc${sex}bcd"
}

def var = "test"

f="Var: ${var} Prettified: ${prettify(var)}"
engine = new GStringTemplateEngine()
tpl = engine.createTemplate(f).make([
        "var": var,"prettify": prettify
])
print tpl.toString()